//
//  UILabel+Extension.swift
//  Weibo
//
//  Created by Northwan on 16/1/24.
//  Copyright © 2016年 Northwan. All rights reserved.
//

import UIKit


extension UILabel{

    
    convenience init(text:String? = nil, textColor:UIColor,fontSize:CGFloat,maxWidth:CGFloat = 0) {
        self.init()
        self.text = text
        self.textColor = textColor
        self.font = UIFont.systemFontOfSize(fontSize)
        
        if maxWidth > 0{
            numberOfLines = 0
            //设置最大宽度,让系统知道在什么位置需要换行
            preferredMaxLayoutWidth = maxWidth
        }
    }
}
